<!--
 /**
* Date: 2022-03-22 16:00
* Desc: 详情-基本信息
 */
-->
<template>
  <div class="base-info">
    <zm-detail-table class="mt10" :list="column" :info="form" :is-form-sale="isFormSale" />
    <single-detail v-if="singDetailParams.visible" v-model="singDetailParams.visible" :obj="singDetailParams.obj"></single-detail>
  </div>
</template>
<script>
import ZmDetailTable from '@/components/zmDetailTable'
import { baseInfo } from './const'
import { getProductInfo } from '@/api/src/productDraft'

import SingleDetail from './components/SingleDetail.vue'

export default {
  name: 'BaseInfo',
  components: { ZmDetailTable, SingleDetail },
  props: {
    id: {
      type: String,
      required: true
    },
    isFormSale: {
      type: Boolean,
      default: false
    }
  },
  data () {
    return {
      form: {},
      singDetailParams: {
        visible: false,
        obj: {}
      }
    }
  },
  computed: {
    column () {
      return baseInfo(this)
    }
  },
  created () {
    this.init()
  },
  mounted () { },
  methods: {
    async init () {
      this.form = await getProductInfo({ id: this.id })
    },
    checkDetail (item) {
      this.singDetailParams = {
        visible: true,
        obj: { ...item, isMulti: '0' }
      }
    }
  }
}
</script>
